package com.javastudy.autowiredStudy.springmvcIntercepter;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.DispatcherServlet;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * springmvc拦截器自定义
 * @author mac
 * @date 2021/9/7 4:01 下午
 */
@Component
public class MVCIntercepter extends HandlerInterceptorAdapter {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        String requestURI = request.getRequestURI();
        if (checkAuth(requestURI)){
            return true;
        }
        return false;
    }

    private boolean checkAuth(String requestUrl){
        //日志，权限，统计
        return true;
    }
}
